<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>出版物监测智能化平台</title>
	<link rel="stylesheet" type="text/css" href="/css/editor.css" />
	<script type="text/javascript" th:src="*{docserviceApiUrl}"></script>
<!--	<script type="text/javascript" *{docserviceApiUrl}></script>-->
<!--	<script th:src="*{docserviceApiUrl}"></script>-->
<!--	[[${docserviceApiUrl}]]-->


	<script type="text/javascript" language="javascript">



		var doca;

		var innerAlert = function (message) {
			if (console && console.log)
				console.log(message);
		};

		var onReady = function () {
			innerAlert("Document editor ready");
		};

		var onDocumentStateChange = function (event) {
			var title = document.title.replace(/\*$/g, "");
			document.title = title + (event.data ? "*" : "");
		};

		var onRequestEditRights = function () {
			location.href = location.href.replace(RegExp("mode=view\&?", "i"), "");
		};

		var onError = function (event) {
			if (event)
				innerAlert(event.data);
		};

		var onOutdatedVersion = function (event) {
			location.reload(true);
		};

		var сonnectEditor = function () {
			var config={
				"document":{
					"fileType": "docx",
					"key": "[[${ file.document.key}]]",

					// "key": "1469489841",
					"title": "[[${fileName}]]",
					"url": $("#url").val(),
					// "url": "http://192.168.1.115:8084/OnlineEditorsExampleJava_war_exploded/app_data/172.31.60.177/2asda.docx"
				},
				"documentType": "text",
				"editorConfig": {
					"callbackUrl":$("#callbackUrl").val(),

					// "callbackUrl":"http://192.168.1.115:8084/OnlineEditorsExampleJava_war_exploded/CallBackServlet?"+"fileName=15d723123123114eqe7d47abe0c7851f.docx",
					"customization":{
						"forcesave":"true"
					},
					"user": {
						"id": "[[${file.editorConfig.user.id}]]",
						"name":"[[${file.editorConfig.user.name}]]"
					},
					"lang":"zh-CN",
				},
				"height": "100%",
				"width": "100%"
			};

			docEditor = new DocsAPI.DocEditor("iframeEditor", config);
		};

		if (window.addEventListener) {
			window.addEventListener("load", сonnectEditor);
		} else if (window.attachEvent) {
			window.attachEvent("load", сonnectEditor);
		}


	</script>

</head>

<body>
<input type="hidden" th:value="${ file.document.url}" id="url">
<input type="hidden" th:value="${ file.editorConfig.callbackUrl}" id="callbackUrl">


<div class="form">
	<div id="iframeEditor"></div>
</div>
<th:block th:include="include :: footer" />
</body>


</html>